package Messages;

/**
 * Different type of messages used to communicate between client, proposers,
 * acceptors and learners.
 */
public enum MessageType {

	/*
	 * Message that get initially exchanged between Client and Server.
	 *
	 * REQUEST_LOCK : Lock that's being requested by client 
	 * RESPONSE_LOCK : Indicates result whether the lock was granted :)  ? or not :(
	 *
	 */
	
	REQUEST_LOCK, RESPONSE_LOCK,

	/*
	 * Client may request release lock once its done with the lock.
	 * TODO : Do we really need this ?
	 */
	RELEASE_LOCK,

	/*
	 * Proposal message relate stuff
	 * 
	 * Send : PREPARE_PROPOSAL 
	 * Receive : PROMISE_ACK if the acceptor has proposal number less than what it received. (Or) 
	 *           PROMISE_NACK if the acceptor has proposal number greater than what it recived.
	 * 
	 */
	PREPARE_PROPOSAL, PROMISE_ACK, PROMISE_NACK,

	/*
	 * Accept messages related. 
	 * Send : ACCEPT 
	 * Receive : ACCEPT_ACK if Acceptors have accepted the proposal. 
	 *           ACCEPT_NACK if Acceptors do not intend to accept proposal.
	 */
	ACCEPT_REQUEST, ACCEPT_ACK, ACCEPT_NACK,

	/*
	 * This will used by acceptors to send what they accepted to learners. 
	 * The learners will then decide what is the final Paxos value choosen by algorithm
	 */
	LEARN
}
